const {getCity} = require("../../utils/cityHttp")
Page({

  data: {
    hot:[],
    cities:[],
    search:[]
  },

  onLoad: function (options) {
    getCity().then(res=>{
      var citys = res.data.data.cities;
      var hot = res.data.data.hotCities;
      var hots = []
      console.log(citys);
      console.log(hot);
      hot.forEach(item=>{
        var {name} = item;
        hots.push(name)
      })
      this.setData({
        cities:citys,
        hot:hots
      })
    })
  },
  onSearch(e){
    var search = this.data.search;
    var value = e.detail;
    search.unshift(value);
    this.setData({
      search
    })
  }
})